﻿' ----------------------------------------------------------------------
'
' NodeCollectionOf.vb
'
'   ... Classes
'
'   This class contains the implementation of a single folder.
'
' ----------------------------------------------------------------------
' version:  1.0.0.1
' today:    02/09/10  12:07:00
' ident:    "@(#)/dbfs/NodeCollectionOf.vb 1.0 0.1 02/09/10 0 rjs"

Imports System.Collections.ObjectModel
Imports System.Xml
Imports System.Xml.Serialization


Namespace Dbfs

    Public Class NodeCollection(Of T)
        Inherits KeyedCollection(Of String, T)
        Implements IXmlSerializable


#Region "Constructors"
        Public Sub New()
            MyBase.New(Nothing, -1)
        End Sub
#End Region

#Region "Methods"
        Public Sub Append(ByVal nodeCollection As NodeCollection(Of T))
            For Each item As Object In nodeCollection
                Add(CType(item, T))
            Next
        End Sub

        Public Sub Sort()
            Dim list As List(Of T)
            list = Items()
            list.Sort()
        End Sub

        ''' <summary>
        ''' Extracts the key from the specified element.
        ''' </summary>
        ''' <param name="item">The element from which to extract the key.</param>
        ''' <returns>The key for the specified element.</returns>
        ''' <remarks></remarks>
        Protected Overrides Function GetKeyForItem(ByVal item As T) As String
            'Return item.NodeID
        End Function
#End Region

#Region "IXmlSerializable Support"
        Public Function GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema
            Throw New System.NotImplementedException()
        End Function

        Public Sub ReadXml(ByVal reader As XmlReader) Implements System.Xml.Serialization.IXmlSerializable.ReadXml
            reader.ReadStartElement("NodeCollection")
            reader.ReadEndElement()
        End Sub

        Public Sub WriteXml(ByVal writer As XmlWriter) Implements System.Xml.Serialization.IXmlSerializable.WriteXml
            writer.WriteStartElement("NodeCollection")
            writer.WriteEndElement()
        End Sub
#End Region

        'Protected Overloads Overrides Function GetKeyForItem(ByVal item As T) As String

        'End Function
    End Class

End Namespace

